package view.item
{
	import control.manager.BitmapManager;
	
	import data.GameConst;
	
	import flash.display.MovieClip;
	import flash.display.Sprite;

	/**
	 * 完成任务后的显示效果 
	 * @author leo
	 * 
	 */	
	public class CompleteTaskEffect extends Sprite
	{
		private var mc :MovieClip;
		public function CompleteTaskEffect()
		{
			super();
			var name :String = GameConst.COMMINT_TASK_EFFECT;
			mc = BitmapManager.instance.getMCByName(name);
			
			if(!mc)
			{
				return;
			}
			
			this.addChild(mc);
			
			
			mc.addFrameScript(mc.totalFrames -1 ,playEndHandler);
		}
		
		private function playEndHandler():void
		{
			this.visible = false;
			
			mc.addFrameScript(0,null);
			mc.gotoAndStop(mc.totalFrames -1);
			
			if(this.parent)
			{
				this.parent.removeChild(this);
			}
		}
	}
}